package com.xingkeduo.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.Instant;

/**
 * @author chi  2019-05-24 20:54
 **/

@Data
@AllArgsConstructor
public class WebsocketMessageResponse<T> {

    /**
     * 发送类型
     */
    private MessageTypeEnum messageTypeEnum;
    /**
     * 门店id
     */
    private String storeId;
    /**
     * 数据
     */
    private T data;

    private Long timestamp = Instant.now().toEpochMilli();


    public WebsocketMessageResponse(MessageTypeEnum messageTypeEnum, String storeId, T data) {
        this.messageTypeEnum = messageTypeEnum;
        this.storeId = storeId;
        this.data = data;
    }


    public WebsocketMessageResponse() {
    }

    public enum  MessageTypeEnum {
        //下单屏登陆
        LOGIN,
        //叫号
        ANNOUNCE_NUMBER,
        //优惠券
        MARKETING,
        //库存相关
        WORKPAD,
        //心跳
        HEARTBEAT

    }
}
